package com.example.forum.model;

import java.util.Date;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.example.forum.utils.ByteDeserializer;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 系统公告实体类
 */
@Data
@ApiModel(description = "系统公告")
public class Announcement {
    
    @ApiModelProperty(value = "公告ID")
    private Long id;
    
    @ApiModelProperty(value = "公告标题")
    @NotBlank(message = "公告标题不能为空")
    private String title;
    
    @ApiModelProperty(value = "公告内容")
    @NotBlank(message = "公告内容不能为空")
    private String content;
    
    @ApiModelProperty(value = "公告类型: notice-普通公告, important-重要公告, system-系统公告")
    private String type = "notice";
    
    @ApiModelProperty(value = "是否置顶: 0-不置顶, 1-置顶")
    @JsonDeserialize(using = ByteDeserializer.class)
    private Byte isTop = 0;
    
    @ApiModelProperty(value = "发布者ID")
    @NotNull(message = "发布者ID不能为空")
    private Long publisherId;
    
    @ApiModelProperty(value = "发布者名称")
    private String publisherName;
    
    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;
    
    @ApiModelProperty(value = "更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;
    
    @ApiModelProperty(value = "开始展示时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date startTime;
    
    @ApiModelProperty(value = "结束展示时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date endTime;
    
    @ApiModelProperty(value = "状态: 0-草稿, 1-已发布, 2-已过期")
    private Byte status = 1;
    
    @ApiModelProperty(value = "点击量")
    private Integer viewCount = 0;
    
    @ApiModelProperty(value = "删除状态: 0-正常, 1-已删除")
    private Byte deleteState = 0;
} 